﻿<Window x:Class="Jbe.TestSuite.Infrastructure.Shell.Presentation.ShellWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:i="http://www.codeplex.com/CompositeExtensions/TestSuite/Interface"
    xmlns:cal="http://www.codeplex.com/CompositeWPF"
    xmlns:cae="http://www.codeplex.com/CompositeExtensions"
    xmlns:v="clr-namespace:Jbe.TestSuite.Infrastructure.Shell.Presentation"
    xmlns:p="clr-namespace:Jbe.TestSuite.Infrastructure.Shell.Properties"
    Title="{Binding Title}" Width="850" Height="600" Icon="/TestSuite;component/Resources/TestSuite.ico"
    cae:ResourceService.MergeSharedDictionaries="{x:Static i:ResourceHelper.SharedResourcePath}">

    <Window.InputBindings>
        <KeyBinding Command="{x:Static i:DocumentCommands.Open}" Modifiers="Control" Key="O"/>
        <KeyBinding Command="{x:Static i:DocumentCommands.Save}" Modifiers="Control" Key="S"/>
    </Window.InputBindings>
    
    <DockPanel x:Name="mainPanel">
        <DockPanel.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="/Resources/StyleResources.xaml"/>
                    <ResourceDictionary Source="/Resources/ImageResources.xaml"/>
                </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>
        </DockPanel.Resources>
            
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="{x:Static p:Resources.FileMenu}">
                <MenuItem Header="{x:Static p:Resources.NewMenu}" cal:RegionManager.RegionName="{x:Static i:ShellRegionNames.NewMenuItems}" Icon="{StaticResource NewImage}" 
                          IsEnabled="{Binding Items.IsEmpty, Converter={x:Static v:NegationConverter.Default}, RelativeSource={RelativeSource Self}}"
                          ItemContainerStyle="{StaticResource NewCommandStyle}"/>
                <MenuItem Header="{x:Static p:Resources.OpenMenu}" Command="{x:Static i:DocumentCommands.Open}" Icon="{StaticResource OpenImage}" InputGestureText="{x:Static p:Resources.OpenShortCutKey}"/>
                <Separator/>
                <MenuItem Header="{x:Static p:Resources.CloseMenu}" Command="{x:Static i:DocumentCommands.Close}"/>
                <MenuItem Header="{x:Static p:Resources.SaveMenu}" Command="{x:Static i:DocumentCommands.Save}" Icon="{StaticResource SaveImage}" InputGestureText="{x:Static p:Resources.SaveShortCutKey}"/>
                <MenuItem Header="{x:Static p:Resources.SaveAsMenu}" Command="{x:Static i:DocumentCommands.SaveAs}"/>
                <Separator/>
                <MenuItem Header="{x:Static p:Resources.ExitMenu}" Command="{Binding ExitCommand}"/>
            </MenuItem>
            
            <MenuItem Header="{x:Static p:Resources.EditMenu}">
                <MenuItem Header="{x:Static p:Resources.UndoMenu}" Command="ApplicationCommands.Undo" Icon="{StaticResource UndoImage}"/>
                <MenuItem Header="{x:Static p:Resources.RedoMenu}" Command="ApplicationCommands.Redo" Icon="{StaticResource RedoImage}"/>
                <Separator/>
                <MenuItem Header="{x:Static p:Resources.CutMenu}" Command="ApplicationCommands.Cut" Icon="{StaticResource CutImage}"/>
                <MenuItem Header="{x:Static p:Resources.CopyMenu}" Command="ApplicationCommands.Copy" Icon="{StaticResource CopyImage}"/>
                <MenuItem Header="{x:Static p:Resources.PasteMenu}" Command="ApplicationCommands.Paste" Icon="{StaticResource PasteImage}"/>
                <Separator/>
                <MenuItem Header="{x:Static p:Resources.DeleteMenu}" Command="ApplicationCommands.Delete" Icon="{StaticResource DeleteImage}"/>
                <MenuItem Header="{x:Static p:Resources.SelectAllMenu}" Command="ApplicationCommands.SelectAll"/>
            </MenuItem>
            
            <MenuItem Header="{x:Static p:Resources.ViewMenu}" cal:RegionManager.RegionName="{x:Static i:ShellRegionNames.ViewMenuItems}"/>
            
            <MenuItem Header="{x:Static p:Resources.HelpMenu}" cal:RegionManager.RegionName="{x:Static i:ShellRegionNames.HelpMenuItems}">
                <MenuItem Header="{x:Static p:Resources.AboutMenu}" Command="{Binding ShowAboutCommand}"/>
                <Separator/>
            </MenuItem>
        </Menu>

        <ToolBarTray DockPanel.Dock="Top" cal:RegionManager.RegionName="{x:Static i:ShellRegionNames.ToolBarTray}">
            <ToolBar cal:RegionManager.RegionName="{x:Static i:ShellRegionNames.MainToolBar}">
                <Button x:Name="newButton" ToolTip="{x:Static p:Resources.New}" Content="{StaticResource NewImage}">
                    <Button.ContextMenu>
                        <ContextMenu ItemContainerStyle="{StaticResource NewCommandStyle}"
                                     cal:RegionManager.RegionName="{x:Static i:ShellRegionNames.NewButtonItems}"/>
                    </Button.ContextMenu>
                </Button>
                <Button Command="{x:Static i:DocumentCommands.Open}" ToolTip="{x:Static p:Resources.Open}" Content="{StaticResource OpenImage}"/>
                <Button Command="{x:Static i:DocumentCommands.Save}" ToolTip="{x:Static p:Resources.Save}" Content="{StaticResource SaveImage}"/>
                <Separator/>
                <Button Command="ApplicationCommands.Cut" ToolTip="{x:Static p:Resources.Cut}" Content="{StaticResource CutImage}"/>
                <Button Command="ApplicationCommands.Copy" ToolTip="{x:Static p:Resources.Copy}" Content="{StaticResource CopyImage}"/>
                <Button Command="ApplicationCommands.Paste" ToolTip="{x:Static p:Resources.Paste}" Content="{StaticResource PasteImage}"/>
            </ToolBar>
        </ToolBarTray>
        
        <StatusBar DockPanel.Dock="Bottom">
            <StatusBarItem Name="statusLabel" Content="{Binding StatusMessage}"/>
        </StatusBar>

        <Grid x:Name="contentPanel">
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            
            <TabControl cal:RegionManager.RegionName="{x:Static i:ShellRegionNames.LeftRegion}" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" MinWidth="200"
                        TabStripPlacement="Bottom" Visibility="{Binding Items.IsEmpty, 
                            Converter={x:Static v:BoolToCollapsedConverter.Default}, RelativeSource={RelativeSource Self}}" 
                        ItemContainerStyle="{StaticResource ViewTabStyle}"/>
            <TabControl cal:RegionManager.RegionName="{x:Static i:ShellRegionNames.ContentRegion}" Grid.Row="0" Grid.Column="1" 
                        ItemContainerStyle="{StaticResource DocumentTabStyle}"/>
            <TabControl cal:RegionManager.RegionName="{x:Static i:ShellRegionNames.RightRegion}" Grid.Row="0" Grid.Column="2" Grid.RowSpan="2" MinWidth="200"
                        TabStripPlacement="Bottom" Visibility="{Binding Items.IsEmpty, 
                            Converter={x:Static v:BoolToCollapsedConverter.Default}, RelativeSource={RelativeSource Self}}" 
                        ItemContainerStyle="{StaticResource ViewTabStyle}"/>
            <TabControl cal:RegionManager.RegionName="{x:Static i:ShellRegionNames.BottomRegion}" Grid.Row="1" Grid.Column="1" MinHeight="150" 
                        TabStripPlacement="Bottom" Visibility="{Binding Items.IsEmpty, 
                            Converter={x:Static v:BoolToCollapsedConverter.Default}, RelativeSource={RelativeSource Self}}" 
                        ItemContainerStyle="{StaticResource ViewTabStyle}"/>
            
            <GridSplitter Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Width="4" HorizontalAlignment="Right" VerticalAlignment="Stretch"/>
            <GridSplitter Grid.Row="0" Grid.Column="2" Grid.RowSpan="2" Width="4" HorizontalAlignment="Left" VerticalAlignment="Stretch"/>
            <GridSplitter Grid.Row="0" Grid.Column="1" Height="4" HorizontalAlignment="Stretch" VerticalAlignment="Bottom"/>
        </Grid>
    </DockPanel>
</Window>
